home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 18 April 1997
- //
- // Description:
- // This implements the various global proc and variables needed
- // for polygons
- //
-
- // these proc are called mainly from PolygonsMenu.mel and EditPolygonsMenu.
- // however, we need to have them defined here, because polygons menu
- // is read only once the user has pulled down the polygons menu:
- // this could make the shelf and other user defined UI fail
- // if the PolygonsMenu has not been created and these functions are called.
-
-
- global proc toggleAutoShowColorPerVertex ()
- {
- int $val=`optionVar -q polyAutoShowColorPerVertex`;
- if ($val) $val=0; else $val=1;
- optionVar -intValue polyAutoShowColorPerVertex $val;
-
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -ex toggleAutoShowColorPerVertexItem` )
- menuItem -e -cb `optionVar -q polyAutoShowColorPerVertex`
- toggleAutoShowColorPerVertexItem;
- }
-
- global proc togglePolyMoveComponents ()
- {
- int $val=`optionVar -q polyKeepFacetsGrouped`;
- if ($val) $val=0; else $val=1;
- optionVar -intValue polyKeepFacetsGrouped $val;
-
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -ex toggleGroupItem` )
- menuItem -e -cb `optionVar -q polyKeepFacetsGrouped` toggleGroupItem;
- }
-
- global proc togglePolyAutoInstallAction ()
- {
- int $val=`optionVar -q polyAutoInstallAction`;
- if ($val) $val=0; else $val=1;
- optionVar -intValue polyAutoInstallAction $val;
-
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -ex toggleAutoInstallItem` )
- menuItem -e -cb `optionVar -q polyAutoInstallAction` toggleAutoInstallItem;
- }
-
- global proc toggleDisplayPolyCount()
- {
- int $val = 1;
- if (`optionVar -exists polyCount`) {
- $val=`optionVar -q polyCount`;
- if ($val) $val=0; else $val=1;
- }
- optionVar -intValue polyCount $val;
- eval("polyEvaluate -ds");
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -ex toggleDisplayPolyCountItem` ) {
- menuItem -e -cb `optionVar -q polyCount` toggleDisplayPolyCountItem;
- }
- }
-
- global proc togglePolyAutoConvertAction ()
- {
- int $val=`optionVar -q polyAutoConvertAction`;
- if ($val) $val=0; else $val=1;
- optionVar -intValue polyAutoConvertAction $val;
-
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -ex toggleAutoConvertItem` )
- menuItem -e -cb `optionVar -q polyAutoConvertAction` toggleAutoConvertItem;
- }
-
- global proc togglePolyPlanarConstraints ()
- {
- int $val =`optionVar -q polyKeepFacetsPlanar`;
- if ($val == 0) $val=1; else $val=0;
-
- // catch a potential error , then set the correct value for polyKeepFacetsPlanar
- string $cmd=("polyCreateFacetCtx -e -pc " + $val
- + " polyCreateFacetContext; polyAppendFacetCtx -e -pc " + $val
- + " polyAppendFacetContext;");
- if (catch (eval($cmd)))
- warning "Could not make the current facet planar: constrain can't be set now.";
-
- $val=`polyAppendFacetCtx -q -pc polyAppendFacetContext`
- + `polyCreateFacetCtx -q -pc polyCreateFacetContext`;
- if ($val == 2) $val=1;
- else if ($val == 1) {
- $val=0;
- $cmd=("polyCreateFacetCtx -e -pc " + $val
- + " polyCreateFacetContext; polyAppendFacetCtx -e -pc " + $val
- + " polyAppendFacetContext;");
-
- catch (eval($cmd));
- }
-
- optionVar -intValue polyKeepFacetsPlanar $val;
- // Menu item may not exist if this has been called from the shelf
- if ( `menuItem -exists togglePlanarItem` )
- menuItem -e -cb `optionVar -q polyKeepFacetsPlanar` togglePlanarItem;
- }
-
- global proc togglePolyCreateShaderWithMapping ()
- {
- int $val =`optionVar -q polyCreateShaderWithMapping`;
- if ($val == 0) $val=1; else $val=0;
- optionVar -intValue polyCreateShaderWithMapping $val;
-
- if ( `menuItem -exists toggleCreateShaderItem` )
- menuItem -e -cb `optionVar -q polyCreateShaderWithMapping` toggleCreateShaderItem;
- }
-
-
- // global proc initPolygonsUI ()
- // {
- // the following lines are not _necessary_. they are here
- // to allow keeping track of all the global variables used in
- // polygon interaction
- global string $polyTextureColorShader="";
- // we need to synchronize user's chosen defaults with the display defaults:
- if (`exists "polysDisplaySetup"`) {
- int $tmpObjsAffected = `optionVar -q displayPolyObjsAffected`;
- optionVar -intValue displayPolyObjsAffected 0;
- catch (`polysDisplaySetup 0`);
- optionVar -intValue displayPolyObjsAffected 1;
- catch (`polysDisplaySetup 0`);
- optionVar -intValue displayPolyObjsAffected $tmpObjsAffected;
- }
- polySelectConstraint
- -ws `optionVar -q polyFaceSensitive`;
-
- // Always disable the polyCount display on startUp
- optionVar -intValue polyCount 0;
-
- // Stuff for Options->GeneralPreferences->Display
- //
- polyOptions -np -sn `optionVar -q newPolyNormalSize`;
-
- float $longueurNorm[] = `polyOptions -q -np -sn`;
-
- polyOptions -np -sb `optionVar -q newPolyBorderEdgeSize`;
- polyOptions -np -dv `optionVar -q newPolyVtxDisp`;
- polyOptions -np -bcv `optionVar -q newPolyVtxBackCull`;
-
- int $point = `optionVar -q newPolyVertexNormals`;
- int $facet = `optionVar -q newPolyFacetNormalDisp`;
-
- polyOptions -np -dn ($point || $facet);
-
- if( $point && $facet )
- polyOptions -np -pf;
- else if( $point )
- polyOptions -np -pt;
- else if( $facet )
- polyOptions -np -f;
-
- int $edgeDisp = `optionVar -q newPolyEdgeDisp`;
- if( $edgeDisp == 0 )
- polyOptions -np -ae;
- else if( $edgeDisp == 1 )
- polyOptions -np -se;
- else if( $edgeDisp == 2 )
- polyOptions -np -he;
-
- polyOptions -np -db `optionVar -q newPolyBorderEdgeHilite`;
- polyOptions -np -dmb `optionVar -q newPolyBorderMapHilite`;
- polyOptions -np -dc `optionVar -q newPolyFacetCentreDisp`;
- polyOptions -np -dt `optionVar -q newPolyFacetTrngleDisp`;
- polyOptions -np -dw `optionVar -q newPolyFacetWarpDisp`;
-
- polyOptions -np -din
- `optionVar -q newPolyNumVertexDisp`
- `optionVar -q newPolyNumEdgeDisp`
- `optionVar -q newPolyNumFacetDisp`
- `optionVar -q newPolyNumUvDisp`;
-
- int $backCull = `optionVar -q newPolyBackFaceCull`;
- if( $backCull == 0 )
- polyOptions -np -bc;
- else if( $backCull == 1 )
- polyOptions -np -fb;
- else if( $backCull == 2 )
- polyOptions -np -wbc;
- else if( $backCull == 3 )
- polyOptions -np -hb;
-
- int $colShaded = `optionVar -q newPolyColorShaded`;
- polyOptions -np -cs $colShaded;
-
- int $colChannel = `optionVar -query newPolyColorChannel`;
- if ($colChannel == 1)
- polyOptions -np -cm "none";
- else if ($colChannel == 2)
- polyOptions -np -cm "ambient";
- else if ($colChannel == 3)
- polyOptions -np -cm "ambientDiffuse";
- else if ($colChannel == 4)
- polyOptions -np -cm "diffuse";
- else if ($colChannel == 5)
- polyOptions -np -cm "specular";
- else if ($colChannel == 6)
- polyOptions -np -cm "emission";
-
- // End for stuff Options->GeneralPreferences->Display
- // }
-
-